package o;

import android.content.Context;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.downloadengine.api.SplitTask;
import java.util.List;
import o.cof.d;

public class dqf extends dpn<Boolean, Boolean> {
    protected /* synthetic */ Object ˋ(Context context, Object obj) throws InterruptedException {
        return ॱ(context, (Boolean) obj);
    }

    protected /* synthetic */ void ˏ(Context context, Object obj, Object obj2) throws InterruptedException {
        ˋ(context, (Boolean) obj, (Boolean) obj2);
    }

    protected /* synthetic */ Object ॱ(Context context) throws InterruptedException {
        return ˏ(context);
    }

    public dqf() {
        this.ˊ = "LocaleChangeInstallTask";
    }

    protected Boolean ˏ(Context context) {
        if (ejj.ˊ().ˎ()) {
            Logger.ˎ(this.ˊ, "child mode is open.");
            return Boolean.valueOf(false);
        } else if (cep.ˏ()) {
            return Boolean.valueOf(true);
        } else {
            Logger.ˋ(this.ˊ, "LocaleChangeInstallTask state is fault.");
            return Boolean.valueOf(false);
        }
    }

    protected Boolean ॱ(Context context, Boolean bool) {
        if (bool == null || !bool.booleanValue()) {
            return Boolean.valueOf(false);
        }
        Logger.ˎ("ScheduleRepeatService", this.ˊ + " execute");
        List<SessionDownloadTask> ˋ = dwm.ॱ().ˋ();
        if (!CollectCheck.isEmpty(ˋ)) {
            for (SessionDownloadTask sessionDownloadTask : ˋ) {
                if (!epw.ॱ(context, sessionDownloadTask.ˊˊ())) {
                    ˊ(sessionDownloadTask, coc.ˎ);
                }
            }
        }
        return Boolean.valueOf(true);
    }

    protected void ˋ(Context context, Boolean bool, Boolean bool2) {
    }

    private void ˊ(SessionDownloadTask sessionDownloadTask, coc o_coc) {
        int ˏ = etn.ˏ(sessionDownloadTask.ˊॱ());
        fhz ˋ = fho.ˏ().ˋ("PackageManager");
        if (ˋ != null) {
            cnw o_cnw = (cnw) ˋ.ॱ(cnw.class);
            if (o_cnw != null) {
                List<SplitTask> ᐝˊ = sessionDownloadTask.ᐝˊ();
                if (!CollectCheck.isEmpty(ᐝˊ)) {
                    d ॱ = new d().ˋ(sessionDownloadTask.ˊˊ()).ˏ(sessionDownloadTask.ॱᐝ()).ˊ(ˏ).ˊ(o_coc).ˏ(sessionDownloadTask).ॱ(dwr.ˋ);
                    for (SplitTask splitTask : ᐝˊ) {
                        ॱ.ॱ(splitTask.ॱˊ(), splitTask.ॱᐝ(), splitTask.ᐝॱ());
                    }
                    o_cnw.ˋ(ContentManager.getInstant().getContext(), ॱ.ˎ());
                    return;
                }
                return;
            }
            Logger.e("LocaleChangeInstallTask", "can not found IPackageInstaller Api");
            return;
        }
        Logger.e("LocaleChangeInstallTask", "can not found PackageManager module");
    }
}
